Skip to content

feat(devops): Docker multi-stage production build optimization & security hardening (closes #1335) - #1434

Open
ranjeet150 wants to merge 2 commits into
LabsCrypt:mainfrom
ranjeet150:feat/docker-multistage-optimization-issue-1335
Open

ranjeet150 wants to merge 2 commits into
LabsCrypt:mainfrom
ranjeet150:feat/docker-multistage-optimization-issue-1335

Conversation

@ranjeet150

Copy link
Copy Markdown

Summary

Closes #1335

Implements production Docker multi-stage build optimization and security hardening for FlowFi backend and frontend services.

Key Changes

  • Backend Dockerfile:
    • Multi-stage architecture: compiles TypeScript with devDependencies; runs on minimal with production-only dependencies
    • Security hardening: drops privileges to non-root system user (UID 1001)
    • Layer caching: copies lockfiles before source code to prevent cache invalidation
    • Added HTTP health check for
  • Frontend Dockerfile:
    • 3-stage build pipeline: -> ->
    • Runs Next.js as non-root user
    • Minimal container footprint copying only , , and production modules
    • Added HTTP health check
  • **Root **:
    • Excludes git history, node_modules, build caches, test suites, and documentation from build context

Closes #1335

Ranjeet Kumar added 2 commits September 19, 2026 04:00
…rity hardening (closes LabsCrypt#1335)

- Backend Dockerfile:
  * Stage 1 (builder): install deps with npm ci and compile TypeScript + prisma generate
  * Stage 2 (runner): minimal node:20-alpine with non-root user (nodeapp:nodejs)
  * Layer caching optimization: package*.json copied before source
  * Health check configured for /health
  * chown -R nodeapp:nodejs /app for strict container privilege separation
- Frontend Dockerfile:
  * Multi-stage build (deps -> builder -> runner) with minimal Alpine base
  * Non-root user (nextapp:nodejs)
  * Health check configured
- Root .dockerignore:
  * Exclude node_modules, .git, tests, coverage, and docs from build context

Closes LabsCrypt#1335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevOps] Docker Multi-Stage Production Build Optimization & Security Hardening

1 participant